home *** CD-ROM | disk | FTP | other *** search
-
-
-
- UUUUSSSSGGGGEEEETTTTIIIINNNNFFFFOOOO((((3333PPPP)))) UUUUSSSSGGGGEEEETTTTIIIINNNNFFFFOOOO((((3333PPPP))))
-
-
-
- NNNNAAAAMMMMEEEE
- usgetinfo, usputinfo, uscasinfo - exchange information though an arena
-
- CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<uuuulllloooocccckkkkssss....hhhh>>>>
-
- vvvvooooiiiidddd uuuussssppppuuuuttttiiiinnnnffffoooo ((((uuuussssppppttttrrrr____tttt ****hhhhaaaannnnddddlllleeee,,,, vvvvooooiiiidddd ****iiiinnnnffffoooo))));;;;
-
- vvvvooooiiiidddd ****uuuussssggggeeeettttiiiinnnnffffoooo ((((uuuussssppppttttrrrr____tttt ****hhhhaaaannnnddddlllleeee))));;;;
-
- iiiinnnntttt uuuussssccccaaaassssiiiinnnnffffoooo ((((uuuussssppppttttrrrr____tttt ****hhhhaaaannnnddddlllleeee,,,, vvvvooooiiiidddd ****oooolllldddd,,,, vvvvooooiiiidddd ****nnnneeeewwww))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- When unrelated processes decide to share an arena, it is often useful to
- be able to initially communicate the location of various data structures
- within the arena. A single word (doubleword in 64 bit mode)
- communication area is available inside the arena header block, accessible
- via the functions _u_s_g_e_t_i_n_f_o and _u_s_p_u_t_i_n_f_o. Thus, a process that sets up
- the arena can initialize various locks, semaphores, and common data
- structures, and place a single pointer that any process that joins the
- arena can retrieve. _u_s_p_u_t_i_n_f_o places the data item in the header,
- overwriting any existing information there. _u_s_g_e_t_i_n_f_o will retrieve that
- information. At arena creation time, the value is initialized to zero.
-
- If multiple unrelated processes are starting at arbitrary times, then a
- race condition exists between initializing the arena and setting the
- global information. The _u_s_c_a_s_i_n_f_o function provides a compare and swap
- operation on the data item in the arena header block. To establish race
- free initialization, each joining member should first check the data item
- using _u_s_g_e_t_i_n_f_o and if 0 should allocate a semaphore (using _u_s_n_e_w_s_e_m_a).
- The caller should then use _u_s_c_a_s_i_n_f_o to atomically place the semaphore
- pointer into the communication area. If _u_s_c_a_s_i_n_f_o returns 0 then someone
- else may have beat the caller and the caller should free the semaphore
- and repeat the algorithm starting with re-checking _u_s_g_e_t_i_n_f_o. Note that
- even with one process performing this algorithm, the compare and swap
- operation may fail, so the caller must always be prepared to loop. If 1
- is returned, then the caller has won and can use the semaphore for future
- negotiation.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- usinit(3P).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-